<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 
 * 后台管理员登录日志控制器
 * @author 66diqiu-li
 *
 */
class Admin_Adminloginlog_module extends CI_Module {
	
	/**
     * 站点ID
     * @var string
     */
    private $sid = '';

	/**
	 * 
	 * 构造函数
	 */
    public function __construct(){
    	parent::__construct();
        $this->sid = $GLOBALS['sid'];
    	$this->load->model('admin.Adminloginlog_model');
    }
	
	/**
	 * 
	 * 管理员登录日志列表
	 */
    function index(){
    	
    	//查询条件
    	$this->load->library('mycommonclass');
        $where = "sid='".$this->sid."'";
    	
        $page_config['perpage']=20;   //每页条数
        $page_config['part']=2;//当前页前后链接数量
        $page_config['url']='admin/adminloginlog/index';//url
        $page_config['seg']=4;//参数取 index.php之后的段数，默认为3，即index.php/control/function/18 这种形式
        $page_config['nowindex']=$this->uri->segment($page_config['seg']) ? $this->uri->segment($page_config['seg']):1;//当前页
        $page_config['total'] = $this->Adminloginlog_model->get_count($where);
        $this->load->library('mypageclass');
        $this->mypageclass->initialize($page_config);        
        $result = $this->Adminloginlog_model->get_list($page_config['perpage'],$page_config['nowindex'],$where);   
        $data['list'] = $result;
        $this->load->view('adminloginlog/adminloginlog_index',$data);
    }
    
    /**
     * 
     * 删除操作
     */
    function ajax_remove(){
    	$res = $this->Adminloginlog_model->deleteAMonthago();    
        if($res){
            $this->success('操作成功',site_url('admin/adminloginlog/index'),true);
        }else{
        	$this->error('操作失败','',true);
        }
    }
}